{% extends 'base.html' %}

{% block page-main %}
    <div class="container-fluid">
        <div class="row">
            {% include 'manage_nav.html' %}
            <div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main">
                <h1 class="page-header">添加文章</h1>

                <div class="panel panel-primary">
                    <!-- Default panel contents -->
                    <div class="panel-heading">添加文章</div>
                    <div class="panel-body">
                        <form action="{% url 'article_add' %}" method="post" class="form-horizontal" novalidate>
                            {% csrf_token %}
                            <div class="form-group">
                                <div class="col-sm-5">
                                    {% for field in form_obj %}
                                        <div class="form-group {% if field.errors %}has-error{% endif %}">

                                            <label for="{{ field.id_for_label }}"
                                                   class="col-sm-2 control-label">{{ field.label }}</label>
                                            <div class="col-sm-8">
                                                {{ field }}
                                                <span class="help-block"> {{ field.errors.0 }} </span>
                                            </div>
                                        </div>
                                    {% endfor %}
                                    {% for field in detailform_obj %}
                                        <div class="form-group {% if field.errors %}has-error{% endif %}">

                                            <label for="{{ field.id_for_label }}"
                                                   class="col-sm-2 control-label">{{ field.label }}</label>
                                            <div class="col-sm-8">
                                                {{ field }}
                                                <span class="help-block"> {{ field.errors.0 }} </span>
                                            </div>
                                        </div>
                                    {% endfor %}
                                </div>
                            </div>
                            <p>
                                <button type="submit" class="btn btn-success">提交</button>
                            </p>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
{% endblock %}